﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/lib/layui/css/layui.css" rel="stylesheet" />
    <title>添加模块</title>
</head>
<body>
    <form class="layui-form" id="formAdd" action="/System/AddModule" method="post">
        <div class="form-group">
            <label class="layui-form-label">模块名</label>
            <div class="layui-input-inline">
                <input type="text" name="MModuleName" value="" required lay-verify="required" placeholder="请输入模块名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="form-group">
            <label class="layui-form-label">父Id</label>
            <div class="layui-input-inline">
                <input type="text" name="MParentId" value="" required lay-verify="required" placeholder="请输入父Id" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="form-group">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="subData">立即提交</button>
            </div>
        </div>
    </form>
    <script src="~/lib/layui/layui.js"></script>
    <script>

        layui.use(['layer', 'form'], function () {
            $ = layui.jquery;
            var layer = layui.layer, form = layui.form;
            form.on('submit(subData)', function (data) {
                var str = $("#formAdd").serialize();
                $.post("/System/AddModule", str, function (res) {
                    if (res.status) {
                        layer.msg("添加成功", function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            //修改成功后刷新父界面
                            window.parent.location.reload();
                        });
                    }
                    else {
                        layer.msg(res.message)
                    }
                }, "Json");
                return false;
            });
        });
    </script>
</body>
</html>

